package weapon

import (
	"fmt"
	"math"
	"ys.calc/pointFunction"
	"ys.calc/role"
)

func InitBrumalStar(refineLevel float64, times float64) Weapon {
	var subStatValue = 33.1
	var mainStateValue = 608.0
	return Weapon{
		Name:     fmt.Sprintf("精%d冬极白星%d层", int(refineLevel), int(times)),
		Atk:      mainStateValue,
		Code:     2,
		SubState: subStatValue,
		SubStateFunc: func(r *role.Role) {
			pointFunction.AddCritRate(subStatValue, r)
		},
		SpFunc: func(r *role.Role) {
			BrumalStarSp(refineLevel, times, r)
		},
	}
}
func BrumalStarSp(refineLevel float64, times float64, r *role.Role) {
	minTimes := math.Min(4, times)
	refineLevel = math.Min(5, refineLevel)
	refine := 1 + (refineLevel-1)*0.25
	r.Increase += 12 * refine * refine
	percentAtk := 10 * minTimes * refine
	if minTimes == 4 {
		percentAtk += 8 * refine
	}
	r.AtkEx += r.Atk * percentAtk / 100
}
